package base.Stream流;

import java.util.ArrayList;
import java.util.Collections;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;

public class 中间方法 {
    public static void main(String[] args) {

        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list,"张无忌-男-18","周芷若-女-17","赵敏-女-18","张三丰-男-19");

        list.stream().filter(s -> s.startsWith("张"));

        Stream.concat(list.stream().filter(s -> s.startsWith("张")),list.stream())
                .forEach(s -> System.out.println(s));

        list.stream().map(new Function<String, Integer>() {
            @Override
            public Integer apply(String s) {
                   return Integer.parseInt(s.split("-")[2]);
            }
        }).forEach(new Consumer<Integer>() {
            @Override
            public void accept(Integer integer) {
                System.out.println(integer);
            }
        });


    }
}
